package 集合相关properties;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Properties;

public class PropertiesDemo {
	public static void main(String[] args) throws FileNotFoundException, IOException {

		// Properties properties=System.getProperties();
		// properties.list(System.out);
		properties();
	}

	private static void properties() throws IOException, FileNotFoundException {
		Properties properties = new Properties();
		properties.load(new FileInputStream("Prop1.properties"));
		Enumeration<?> enum1 = properties.propertyNames();// 得到配置文件的名字
		while (enum1.hasMoreElements()) {
			String strKey = (String) enum1.nextElement();
			String strValue = properties.getProperty(strKey);
			System.out.println(strKey + "=" + strValue);
		}
	}

}
